package com.smaato;

import net.rim.blackberry.api.browser.Browser;
import net.rim.device.api.system.EncodedImage;

class SmaatoAdImpl implements SmaatoAd
{
	private EncodedImage iAdImage = null;
	private String iClickThroughUrl = null;
	
	public SmaatoAdImpl(byte[] aImage, String aUrl)
	{
		iAdImage = EncodedImage.createEncodedImage(aImage, 0, aImage.length);
		iClickThroughUrl = aUrl;
	}
	
	public SmaatoAdImpl(EncodedImage aImage, String aUrl)
	{
		iAdImage = aImage;
		iClickThroughUrl = aUrl;
	}
	
	public EncodedImage getImage()
	{
		return iAdImage;
	}
	
	public void clickThrough()
	{
		if(iClickThroughUrl != null)
		{
			Browser.getDefaultSession().displayPage(iClickThroughUrl);
		}
	}
}
